<script setup lang="ts">
import {ref,watch} from "vue";

var count = ref(0);

function handleClick() {
  console.log("数据加1：" + count.value);
  count.value++;
}

watch(count,(newValue,oldValue) => {
  console.log(`count 从 ${oldValue} 变为 ${newValue}`);
})
</script>

<template>
  <div>
    <button @click="handleClick">点击</button>
    <div>count is: {{ count }}</div>
  </div>
</template>